/*
* © 2010 Autodata Solutions Company. All Rights Reserved
* This source code is the confidential and proprietary information of Autodata Solutions Company.
* The user shall not, in whole or in part, copy, publish, disclose or make any use of this source code
* without the prior written consent of Autodata Solutions Company.
*/
Ext.ns('net.autodata.compare.editorial');
(function() {

    /**
    * Display a editorial detail with a customizable view
    * @class EditorialTitlePanel
    * @extends Ext.BoxComponent
    * @namespace ca.autotrader.compare.editorial
    */
    var Panel = Ext.extend(Ext.BoxComponent, {

        autoEl: {
            tag: 'div',
            cls: 'editorial-title-panel'
        },
        
        height: 43,

        /**
        * @property detail
        * @type Object
        */
        detail: undefined,

        /**
        * @property view
        * @type Object
        */
        view: undefined,

        constructor: function() {
            Panel.superclass.constructor.apply(this, arguments);
        },

        initComponent: function() {
            Panel.superclass.initComponent.apply(this, arguments);
            var view = this.getView();
            view.init(this);
            this.relayEvents(view, ['remove']);
        },

        /**
        * @method getView
        */
        getView: function() {
            if (!this.view) {
                this.view = new net.autodata.compare.widgets.EditorialTitleView(this.viewCfg);
            }

            return this.view;
        },

        /**
        * @method getDetail
        * @returns Object
        */
        getData: function() {
            return this.data;
        },

        /**
        * @method onRender
        * @private
        */
        onRender: function() {
            Panel.superclass.onRender.apply(this, arguments);
            var view = this.getView();
            view.render();
        }
    });

    net.autodata.compare.editorial.EditorialTitlePanel = Panel;
})();
